using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Backend.JYD.Model;

namespace Backend.JYD.EFDAL.Mapping
{
    public class CodeTypeMap : EntityTypeConfiguration<CodeType>
    {
        public CodeTypeMap()
        {
            // Primary Key
            this.HasKey(t => t.TypeCode);

            // Properties
            this.Property(t => t.TypeCode)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.TypeName)
                .IsRequired()
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("CodeType");
            this.Property(t => t.TypeCode).HasColumnName("TypeCode");
            this.Property(t => t.TypeName).HasColumnName("TypeName");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
            this.Property(t => t.OpId).HasColumnName("OpId");
        }
    }
}
